package com.guyou.guguxinge;

import com.cbs.android.component.application.CBSApplication;
import com.cbs.android.component.applicationutils.Global;
import com.cbs.android.component.push.jpush.JPush;
import com.cbs.android.component.push.pushinterface.PushInterface;
import com.cbs.android.component.sms.mob.Mob;
import com.cbs.android.component.sms.smsinterface.SmsInterface;
import com.cbs.android.component.storage.qiniu.Qiniu;
import com.cbs.android.component.toast.Toast;
import com.cbs.android.module.user.user.UserModule;
import com.cbs.android.module.userkit.ImagePathTranslator;
import com.cbs.android.module.userkit.UserKitSetting;
import com.cbs.component.android.storage.storageinterface.StorageInterface;

/**
 * Created by broche on 23/11/2016.
 */

public class MyApplication extends CBSApplication {
    @Override
    public void onAppCreate() {
        super.onAppCreate();
        Toast.init(this);

        Global.setAppId(1);
        Global.init(this);
        Global.setServerHost("http://192.168.58.12:82");

        PushInterface pushInterface = new JPush(this);
        SmsInterface smsInterface = new Mob(this);
        StorageInterface storageInterface = new Qiniu();
        UserModule.init(this, smsInterface, pushInterface, storageInterface);
        UserModule.setDebug(true);

        UserKitSetting.setImagePathTranslator(new ImagePathTranslator() {
            @Override
            public String avatarPath(String imagePath) {
                return String.format("http://image.guguxinge.com/%s", imagePath);
            }

            @Override
            public String homeImagePath(String imagePath) {
                return String.format("http://image.guguxinge.com/%s", imagePath);
            }
        });
        UserKitSetting.setNicknameFilterKeywords(new String[]{"@", " "});
    }
}
